<script>
/*
 * @Author: Your name
 * @Date:   2020-07-15 22:12:19
 * @Last Modified by:   Your name
 * @Last Modified time: 2020-07-24 17:31:36
 */
</script>
<template>
  <div id="detailBasicInfo">
    <p class="title">{{goodsItem.title}}</p>
    <div class="price">
      <span class="newPrice">￥{{goodsItem.newPrice}}</span>
      <span class="oldPrice">￥{{goodsItem.oldPrice}}</span>
      <span class="discount">{{goodsItem.discount}}</span>
    </div>
    <div class="character">
      <div>销量  {{goodsItem.sellCounts}}</div>
      <div>收藏  {{goodsItem.store}}</div>
      <div>{{goodsItem.promise}}</div>
    </div>
    <div class="service">
      <div v-for="item in goodsItem.service" :key="item">{{item}}</div>
    </div>
  </div>
</template>
<script>
import {getDetailMessage, goodsInfos} from '../../../network/detail.js';
export default {
  name: "DetailBasicInfo",
  props:{
    id: {
      type: String,
      default() {
        return ''
      }
    },
    goodsItem: {
      type: Object,
      detault() {
        return {}
      }
    }
  },
  created(){
    // getDetailMessage(this.id)
    // .then((res) => {
    //   this.goodsItem =
    //   new goodsInfos(res.message.title, res.message.newPrice, res.message.oldPrice, res.message.discount, res.message.sellCounts, res.message.store, res.message.service, res.message.promise); 
    //   console.log('goodsItem:',res.message);
    // })
    // .catch((error) => {
    //   console.log(error);
    // })
  }
}
</script>
<style lang="css">
  #detailBasicInfo{
    width: 100%;
    box-sizing: border-box;
    padding: 10px 8px 0px;
  }
  #detailBasicInfo .title{
    font-size: 14px;
    line-height: 18px;
    color: #666;
  }
  #detailBasicInfo .price{
    padding: 10px 0;
    position: relative;
  }
  #detailBasicInfo .price .newPrice{
    font-size: 20px;
    color: var(--color-high-text);
  }
  #detailBasicInfo .price .oldPrice{
    font-size: 13px;
    text-decoration: line-through;
  }
  #detailBasicInfo .price .discount{
    position: absolute;
    display: inline-block;
    background: var(--color-high-text);
    color: #ffffff;
    text-align: center;
    padding: 3px;
    font-size: 10px;
    border-radius: 7px;
    top: 10px;
    margin-left: 8px;
  }
  #detailBasicInfo .character{
    display: flex;
    font-size: 12px;
  }
  #detailBasicInfo .character div{
    flex: 1;
  }
  #detailBasicInfo .character div:nth-child(2){
    text-align: center;
  }
  #detailBasicInfo .character div:nth-child(3){
    text-align: right;
  }
  #detailBasicInfo .service{
    display: flex;
    font-size: 10px;
    justify-content: space-around;
    flex-wrap: nowrap;
    margin-top: 10px;
    border-top: 1px solid #cccccc;
    border-bottom: 1px solid #cccccc;
    padding-top: 15px;
    padding-bottom: 15px;
    color: #000;
  }
  #detailBasicInfo .service div{
    flex: 1;
    text-align: center;
  }
</style>